#!/usr/bin/env python
# coding=utf-8

import requests
from bs4 import BeautifulSoup

fo = open("test.md","w+")

url = "http://www.sina.com"
try:
    r = requests.get(url)
    r.encoding = r.apparent_encoding
    demo = r.text
    soup = BeautifulSoup(demo,"html.parser")
    fo.write(soup.prettify())
    fo.writelines(soup.prettify())
except:
    print("False")

fo.close()
